Skip to content

feat(converters): re-enable variable scripting translations#8388

Merged
vijayh-bruno merged 2 commits into
usebruno:mainfrom
sanish-bruno:feat/enable-api-translations
Jun 29, 2026
Merged

feat(converters): re-enable variable scripting translations#8388
vijayh-bruno merged 2 commits into
usebruno:mainfrom
sanish-bruno:feat/enable-api-translations

Conversation

@sanish-bruno

@sanish-bruno sanish-bruno commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Description

Re-enables Postman ↔ Bruno script translations that were previously commented out because the underlying runtime APIs would not propagate variable mutations to the UI tables. With variable persistence landing in #8315, these APIs now update both the request lifecycle and the UI, so the translations can be turned back on.

JIRA: BRU-3096
JIRA: BRU-3082

Important

Depends on #8315 — that PR must be merged first, otherwise the re-enabled translations will silently fail to update the UI.

Re-enabled translations

Postman API Bruno API
pm.globals.unset bru.deleteGlobalEnvVar
pm.globals.clear bru.deleteAllGlobalEnvVars
pm.collectionVariables.set bru.setCollectionVar
pm.collectionVariables.unset bru.deleteCollectionVar
pm.collectionVariables.clear bru.deleteAllCollectionVars
pm.collectionVariables.toObject bru.getAllCollectionVars

Applied in both directions and to both transformer paths:

  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js (AST/jscodeshift)
  • packages/bruno-converters/src/postman/postman-translations.js (regex fallback)
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js (AST/jscodeshift)

Tests

  • Unskipped 13 it.skip / test.skip blocks across 8 spec files covering the collection-variable APIs.
  • Added 11 new tests for previously uncovered APIs (pm.globals.unset, pm.globals.clear, pm.collectionVariables.clear, pm.collectionVariables.toObject, and their bru.* reverse mappings).
  • npm run test --workspace=packages/bruno-converters → 71/71 suites pass, 1104 tests pass.

Contribution Checklist:

  • I've used AI significantly to create this pull request
  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have added screenshots or gifs to help explain the change if applicable.
  • I have read the contribution guidelines.
  • Create an issue and link to the pull request.

Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.

Publishing to New Package Managers

Please see here for more information.

Summary by CodeRabbit

  • New Features

    • Expanded Postman/Bruno variable translation coverage for global and collection variables, including set, unset, clear, and converting to object form.
    • Enabled additional translation mappings in both Postman-to-Bruno and Bruno-to-Postman conversions.
  • Tests

    • Re-enabled and expanded coverage for previously skipped variable translation scenarios.
    • Added assertions across multiline, nested, alias-based, combined, and test-function cases for pm.collectionVariables.* and pm.globals.*.

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8aa7c094-d9b2-4a9a-b47e-9fd91dcb0ebb

📥 Commits

Reviewing files that changed from the base of the PR and between 62ee62e and aeeea2a.

📒 Files selected for processing (11)
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-comments.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
✅ Files skipped from review due to trivial changes (1)
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
🚧 Files skipped from review as they are similar to previous changes (10)
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.js
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-comments.spec.js

Walkthrough

Postman and Bruno variable translation tables now cover additional global and collection helper calls in both directions. Matching tests were re-enabled and expanded for direct assertions and transpiler scenarios.

Changes

Postman↔Bruno variable translations

Layer / File(s) Summary
Postman to Bruno mappings
packages/bruno-converters/src/postman/postman-translations.js, packages/bruno-converters/src/utils/postman-to-bruno-translator.js
Postman collection and global variable helper calls now map to Bruno helper calls in both translation tables.
Bruno to Postman mappings
packages/bruno-converters/src/utils/bruno-to-postman-translator.js
Bruno collection and global variable helper calls now map back to Postman helper calls again.
Translation tests
packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js, packages/bruno-converters/tests/postman/postman-translations/postman-*.spec.js, packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/*.test.js
Bruno-to-Postman and Postman-to-Bruno variable translation tests now run for global and collection helper cases across direct and transpiler scenarios.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • usebruno/bruno#7052: Updates the same variable-translation mappings in postman-to-bruno-translator.js for Postman global and collection APIs.
  • usebruno/bruno#7069: Covers the same bidirectional Postman↔Bruno variable helper mappings and matching tests.

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • naman-bruno
  • bijin-bruno

Poem

Variables crossed the bridge today,
From Postman scripts to Bruno’s way.
Set, unset, clear—now all align,
In tests that wake and run just fine.
A tiny map with a tidy glow ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: restoring variable scripting translations in the converters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sanish-bruno sanish-bruno changed the title feat(translations): restore commented-out collection and global varia… feat(converters): re-enable variable scripting translations Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{}

@sanish-bruno sanish-bruno force-pushed the feat/enable-api-translations branch from 8bf8ff6 to 62ee62e Compare June 26, 2026 17:35

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js`:
- Around line 109-136: Add a regression test for the newly restored
pm.globals.toObject mapping in the variables translation suite. In
variables.test.js, extend the existing translateCode coverage alongside
pm.globals.unset, pm.globals.clear, and pm.collectionVariables.toObject to
assert that pm.globals.toObject() translates to bru.getAllGlobalEnvVars(). This
should exercise the postman-to-bruno-translator.js behavior so the restored
global toObject mapping stays covered.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0530a85f-18fb-47e9-a77e-636a8654d43d

📥 Commits

Reviewing files that changed from the base of the PR and between 87f7426 and 62ee62e.

📒 Files selected for processing (11)
  • packages/bruno-converters/src/postman/postman-translations.js
  • packages/bruno-converters/src/utils/bruno-to-postman-translator.js
  • packages/bruno-converters/src/utils/postman-to-bruno-translator.js
  • packages/bruno-converters/tests/bruno/bruno-to-postman-translations/variables.test.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-comments.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/postman-variables.spec.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/combined.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/multiline-syntax.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/response.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/testing-framework.test.js
  • packages/bruno-converters/tests/postman/postman-translations/transpiler-tests/variables.test.js

vijayh-bruno
vijayh-bruno previously approved these changes Jun 29, 2026
…ble methods

- Reintroduced translations for `setCollectionVar`, `deleteCollectionVar`, `deleteAllCollectionVars`, and their global counterparts in the Postman to Bruno and Bruno to Postman translators.
- Updated tests to validate the translations for these methods, ensuring accurate functionality and consistency across variable management.
- Removed outdated comments regarding UI updates, reflecting the current state of the implementation.
…als.toObject

- Introduced new test cases to validate the translation of `bru.getAllGlobalEnvVars` to `pm.globals.toObject` and vice versa.
- Enhanced the test suite for both Bruno to Postman and Postman to Bruno translations, ensuring comprehensive coverage for variable management methods.
@vijayh-bruno vijayh-bruno merged commit 49b9af1 into usebruno:main Jun 29, 2026
15 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants